package java_thinking.unit_9._9_3;

/**
 * @Description : 模拟一组电子滤波器
 * @author: cww
 * @DateTime: 2019-03-03 14:47
 */

/**
 * 滤波器
 */
public class Waveform {
    private static long counter;
    private final long id = counter++;
    @Override
    public String toString(){
        return "Waveform "+ id;
    }
}

/**
 * 过滤器，基类；(与Processor.java具有相同的接口元素)
 * 1.可获取子类的类名；
 * 2.根据传入的波形返回一个滤波器对象
 */
class Filter {
    public String name(){
        return getClass().getSimpleName();
    }
    public Waveform process(Waveform input){
        return input;
    }
}

/**
 * 低频过滤
 */
class LowPass extends Filter {
    double cutoff;
    public LowPass (double cutoff) {
        this.cutoff=cutoff;
    }
    @Override
    public Waveform process(Waveform input){
        return input;
    }
}

/**
 * 高频过滤
 */
class HighPass extends Filter {
    double cutoff;
    public HighPass (double cutoff) {
        this.cutoff=cutoff;
    }
    @Override
    public Waveform process(Waveform input){
        return input;
    }
}

/**
 * 环绕
 */
class BandPass extends Filter {
    double cutoff;
    public BandPass (double cutoff) {
        this.cutoff=cutoff;
    }
    @Override
    public Waveform process(Waveform input){
        return input;
    }
}

